<?php
namespace Api\Plugin;

use Api\Exception\BonusException;
use Base\ConstDir\Api\ApiError;
use Zend\Mvc\Controller\Plugin\AbstractPlugin;

abstract class AbstractBonusStrategy extends AbstractPlugin{

    protected $_payDetail;
    protected $_bonusInfo;
    protected $_memberInfo;
    private $sm;


    public function __get($val = null){
        if($val == 'sm') {
            $this->sm = $this->getController()->getServiceLocator();
            return $this->sm;
        }
    }

    public function __construct($options = array()){
        if(empty($options['payDetail']) || empty($options['bonusInfo']) || empty($options['memberInfo'])){
            throw new BonusException(ApiError::PARAMETER_MISSING_MSG, ApiError::PARAMETER_MISSING);
        }
        $this->_payDetail = $options['payDetail'];
        $this->_bonusInfo = $options['bonusInfo'];
        $this->_memberInfo = $options['memberInfo'];
    }

    abstract function run();
}